package com.lin.csdn.service.impl;

import com.lin.csdn.dao.impl.PicDao;
import com.lin.csdn.dao.impl.ReportDao;
import com.lin.csdn.model.po.Messege;
import com.lin.csdn.utils.ResultSplit;

import java.util.List;

public class PicReportService {
     PicDao picDao=new PicDao();
     ReportDao reportDao=new ReportDao();
     ResultSplit split=new ResultSplit();

     //添加博客相关图片路径
     public Messege addPic(String blogId,String path){
         picDao.addPicUrl(Integer.parseInt(blogId.replace(" ","")),path);
         return new Messege("上传成功",null,200);
     }

     //添加举报相关图片路径
     public Messege addReportPic(String reportId,String path){
         picDao.addReportPic(Integer.parseInt(reportId.replace(" ","")),path);
         return new Messege("上传成功",null,200);
     }

     //添加举报信息
     public int addReport(String context,String blogId){
         int reportNew=reportDao.addReport(context,Integer.parseInt(blogId.replace(" ","")));
         return reportNew;
     }

     //查找举报信息
     public List<Object> search(){
         Object result=reportDao.search();
         List<Object> data=split.resultSplit(result);
         return data;
     }

     //查找举报用的图片
     public String reportPic(String reportId){
         String result=picDao.searchReportPic(Integer.parseInt(reportId.replace(" ","")));
         return result;
     }

     //封禁完后更新状态为已经处理
     public Messege ban(String reportId){
         String result=reportDao.ban(Integer.parseInt(reportId.replace(" ","")));
         return new Messege("成功封禁",result,200);
     }

     //查询分享用的二维码
    public String sharePic(String blogId){
        String result=picDao.searchSharePic(Integer.parseInt(blogId.replace(" ","")));
        return result;
    }
}
